import { NestFactory } from '@nestjs/core';
import { Transport, MicroserviceOptions } from '@nestjs/microservices'
import { AppModule } from './app.module';

//pnpm install --save @nestjs/microservices
//pnpm install --save @nestjs/common@^10.0.0 @nestjs/core@^10.0.0

async function bootstrap() {
  const app = await NestFactory.createMicroservice<MicroserviceOptions>(
    AppModule,
    {
      transport: Transport.TCP,
      options: {
        port: 8888,
      },
    },
  );
  app.listen();

  // await app.listen(3000);  微服务不需要暴露 http 接口，只需要支持微服务的通信就行。
}
bootstrap();
